package com.ruoyi.yqhs.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.yqhs.domain.YqhsYplxj;
import com.ruoyi.yqhs.service.IYqhsYplxjService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 硬盘录像机信息Controller
 *
 * @author ruoyi
 * @date 2025-08-31
 */
@RestController
@RequestMapping("/yqhs/yplxj")
public class YqhsYplxjController extends BaseController {
    @Autowired
    private IYqhsYplxjService yqhsYplxjService;

    /**
     * 查询硬盘录像机信息列表
     */
    @PreAuthorize("@ss.hasPermi('yqhs:yplxj:list')")
    @GetMapping("/list")
    public TableDataInfo list(YqhsYplxj yqhsYplxj) {
        startPage();
        List<YqhsYplxj> list = yqhsYplxjService.selectYqhsYplxjList(yqhsYplxj);
        return getDataTable(list);
    }

    /**
     * 导出硬盘录像机信息列表
     */
    @PreAuthorize("@ss.hasPermi('yqhs:yplxj:export')")
    @Log(title = "硬盘录像机信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YqhsYplxj yqhsYplxj) {
        List<YqhsYplxj> list = yqhsYplxjService.selectYqhsYplxjList(yqhsYplxj);
        ExcelUtil<YqhsYplxj> util = new ExcelUtil<YqhsYplxj>(YqhsYplxj.class);
        util.exportExcel(response, list, "硬盘录像机信息数据");
    }

    /**
     * 获取硬盘录像机信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('yqhs:yplxj:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(yqhsYplxjService.selectYqhsYplxjById(id));
    }

    /**
     * 新增硬盘录像机信息
     */
    @PreAuthorize("@ss.hasPermi('yqhs:yplxj:add')")
    @Log(title = "硬盘录像机信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YqhsYplxj yqhsYplxj) {
        return toAjax(yqhsYplxjService.insertYqhsYplxj(yqhsYplxj));
    }

    /**
     * 修改硬盘录像机信息
     */
    @PreAuthorize("@ss.hasPermi('yqhs:yplxj:edit')")
    @Log(title = "硬盘录像机信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YqhsYplxj yqhsYplxj) {
        return toAjax(yqhsYplxjService.updateYqhsYplxj(yqhsYplxj));
    }

    /**
     * 删除硬盘录像机信息
     */
    @PreAuthorize("@ss.hasPermi('yqhs:yplxj:remove')")
    @Log(title = "硬盘录像机信息", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(yqhsYplxjService.deleteYqhsYplxjByIds(ids));
    }

    /**
     * 查询硬盘录像机信息列表
     */
    @GetMapping("/options")
    public AjaxResult options(YqhsYplxj yqhsYplxj) {
        List<YqhsYplxj> list = yqhsYplxjService.selectYqhsYplxjList(yqhsYplxj);
        return success(list);
    }
}
